package cn.jwelll.bxcstock.viewmodel.viewmodel

import android.databinding.BaseObservable
import cn.jwelll.bxcstock.viewmodel.itemmodel.ItemCarInUploadModel
import java.text.DecimalFormat

/**
 * 出库上传界面的 总数据类
 */
class CarInUploadModel : BaseObservable() {
    var id = 0
    var carNum=""

    var waybillCode = ""
    var driverName = ""
    var railwayCode = ""
    var qeueuNumber = ""
    var loadingPoint = ""
    var remark=""
    var weight = 0.0
        get() {
            var w=0.0
            materials?.forEach {
                var smallW=0.0
                it.childList.forEach{
                    smallW+=it.weight
                }
                w+=smallW
            }

            return DecimalFormat("#.000").format(w).toDouble()
        }
    var count=0
        get() {
            var c=0
            materials?.forEach {
                c+=it.childList.size
            }
            return  c
        }

    var materials = ArrayList<ItemCarInUploadModel>()
}